<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html><!-- InstanceBegin template="/Templates/Function Info.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>WinXDraw_GetTextWidth</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<style type="text/css">
<!--
.style3 {font-size: medium}
-->
</style>

<link href="../../WinXStyles.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {
	font-size: x-large;
	font-family: Verdana, Arial, Helvetica, sans-serif;
}
.style2 {
	font-size: large;
	font-family: Verdana, Arial, Helvetica, sans-serif;
}
-->
</style>
</head>

<body>
<h1 class="style1"><img src="../../WinX48.png" width="48" height="48" align="absmiddle"> <!-- InstanceBeginEditable name="title" -->WinXDraw_GetTextWidth<!-- InstanceEndEditable --></h1>
<hr>

<!-- InstanceBeginEditable name="Prototype" -->
<p>result = WinXDraw_GetTextWidth (hFont, STRING text, maxWidth)</p>
<!-- InstanceEndEditable --><!-- InstanceBeginEditable name="Description" -->
<p>Gets the width of a string of text, or alternatively, the number of characters that will fit into a certain space </p>
<!-- InstanceEndEditable -->
<table width="80%" border="1" cellpadding="0" cellspacing="0">
  <tr bgcolor="#CCCCCC">
    <th width="24%"><span class="style3">Parameter</span></th>
    <th width="76%"><span class="style3">Description</span></th>
  </tr>
  <!-- InstanceBeginRepeat name="Parameter Table" --><!-- InstanceBeginRepeatEntry -->
  <tr bgcolor="#E8E8E8">
    <td><!-- InstanceBeginEditable name="Parameter" -->hFont<!-- InstanceEndEditable --></td>
    <td><!-- InstanceBeginEditable name="Description" -->The handle to the font the text will be drawn with <!-- InstanceEndEditable --></td>
  </tr>
  <!-- InstanceEndRepeatEntry --><!-- InstanceBeginRepeatEntry -->
  <tr bgcolor="#E8E8E8">
    <td><!-- InstanceBeginEditable name="Parameter" -->STRING text <!-- InstanceEndEditable --></td>
    <td><!-- InstanceBeginEditable name="Description" -->The string to test <!-- InstanceEndEditable --></td>
  </tr>
  <!-- InstanceEndRepeatEntry --><!-- InstanceBeginRepeatEntry -->
  <tr bgcolor="#E8E8E8">
    <td><!-- InstanceBeginEditable name="Parameter" -->maxWidth<!-- InstanceEndEditable --></td>
    <td><!-- InstanceBeginEditable name="Description" -->The maximum width for the string <!-- InstanceEndEditable --></td>
  </tr>
  <!-- InstanceEndRepeatEntry --><!-- InstanceEndRepeat -->
</table>
<h3>Returns</h3>
<!-- InstanceBeginEditable name="Return Info" -->
<p>If the width of the string is &lt; maxWidth, the return value is the width of the string in pixels. If the width of the string &gt; maxWidth the return value is -1*the number of characters that fit in the available space.</p>
<!-- InstanceEndEditable -->
<h3>Remarks</h3>
<!-- InstanceBeginEditable name="Remarks" -->
<p>The height of the text is specified by the font. Because variable pitch fonts have variable character widths and kerning pairs you need this function to calculate the width of a string.</p>
<!-- InstanceEndEditable -->
<h3>Examples</h3>
<table width="80%"  border="0">
  <tr>
    <td bgcolor="#C6C6FF"><!-- InstanceBeginEditable name="Example Code" -->
      <p class="codeStyle">'how wide is a string?<br>
        ret = WinXDraw_GetTextWidth (hFont, &quot;This is a string&quot;, 200)<br>
        IF ret &gt; 0 THEN<br>
        &nbsp;&nbsp;'ret pixels wide<br>
        ELSE<br>
        &nbsp;&nbsp;'too wide<br>
        END IF  </p>
      <!-- InstanceEndEditable --></td>
  </tr>
</table>

<h2 class="style2">Related Links</h2>
<!-- InstanceBeginEditable name="Related Links" -->
<p><a href="../../WinX%20Programmer%27s%20Guide/Auto%20Draw.htm/Text.htm">Text and Fonts</a><br>
<a href="../Auto%20Draw.htm/WinXDrawText.htm">WinXDrawText</a><br>
<a href="WinXDraw_GetFontHeight.htm">WinXDraw_GetFontHeight</a></p>
<!-- InstanceEndEditable -->
</body>
<!-- InstanceEnd --></html>
